package com.yk.satoken.demos.minio.util;

import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.multipart.MultipartResolver;
import org.springframework.web.multipart.support.StandardServletMultipartResolver;

import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author YangKai
 * @create 2024-06-02 15:42
 * @version: 1.0
 * @Description:
 */
public class UpUtil {




    /**
     * 获取文件大小
     */
    public static long getFileSize(MultipartFile multipartFile){
        return multipartFile.getSize();
    }

    /**
     * 获取文件类型
     */
    public static String getFileType(MultipartFile multipartFile){
        if (multipartFile.getContentType()!=null) {
            String[] split = multipartFile.getOriginalFilename().split("\\.");
            if (split.length>1) {
                return split[split.length-1];
            }
        }
        return "";
    }



}
